package com.gupaoedu.design.strategy.pro_single.lazy;

/**
 * <p></p>
 *
 * @author Andy
 * @date 2018/3/12.
 */
public class LazyThree {
    private static boolean initialized = false;

    private LazyThree() {
       synchronized(LazyThree.class) {
           if (initialized == false) {
               initialized = !initialized;
           }else {
               throw new RuntimeException("单例实例已被侵入。");
           }
       }
    }

    private static class LazyThreeInner {
        private static final LazyThree instance = new LazyThree();
    }

    public static final LazyThree newInstance() {
        return LazyThreeInner.instance;
    }
}
